/******************************************************************************* 
 *  Copyright 2007 Amazon Technologies, Inc.  
 *  Licensed under the Apache License, Version 2.0 (the "License"); 
 *  
 *  You may not use this file except in compliance with the License. 
 *  You may obtain a copy of the License at: http://aws.amazon.com/apache2.0
 *  This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 
 *  CONDITIONS OF ANY KIND, either express or implied. See the License for the 
 *  specific language governing permissions and limitations under the License.
 * ***************************************************************************** 
 *    __  _    _  ___ 
 *   (  )( \/\/ )/ __)
 *   /__\ \    / \__ \
 *  (_)(_) \/\/  (___/
 * 
 *  Amazon ECS CSharp Library
 *  API Version: 2007-07-16
 *  Generated: Thu Aug 02 10:15:38 PDT 2007 
 * 
 */

using System;
using System.Xml.Serialization;
using System.Collections.Generic;
using System.Text;


namespace Amazon.ECS.Model
{
    [XmlTypeAttribute(Namespace = "http://webservices.amazon.com/AWSECommerceService/2007-07-16")]
    [XmlRootAttribute(Namespace = "http://webservices.amazon.com/AWSECommerceService/2007-07-16", IsNullable = false)]
    public class OperationInformation
    {
    
        private String nameField;

        private String descriptionField;

        private  RequiredParameters requiredParametersField;
        private  AvailableParameters availableParametersField;
        private  DefaultResponseGroups defaultResponseGroupsField;
        private  AvailableResponseGroups availableResponseGroupsField;

        /// <summary>
        /// Gets and sets the Name property.
        /// </summary>
        [XmlElementAttribute(ElementName = "Name")]
        public String Name
        {
            get { return this.nameField ; }
            set { this.nameField= value; }
        }



        /// <summary>
        /// Sets the Name property
        /// </summary>
        /// <param name="name">Name property</param>
        /// <returns>this instance</returns>
        public OperationInformation WithName(String name)
        {
            this.nameField = name;
            return this;
        }



        /// <summary>
        /// Checks if Name property is set
        /// </summary>
        /// <returns>true if Name property is set</returns>
        public Boolean IsSetName()
        {
            return  this.nameField != null;

        }


        /// <summary>
        /// Gets and sets the Description property.
        /// </summary>
        [XmlElementAttribute(ElementName = "Description")]
        public String Description
        {
            get { return this.descriptionField ; }
            set { this.descriptionField= value; }
        }



        /// <summary>
        /// Sets the Description property
        /// </summary>
        /// <param name="description">Description property</param>
        /// <returns>this instance</returns>
        public OperationInformation WithDescription(String description)
        {
            this.descriptionField = description;
            return this;
        }



        /// <summary>
        /// Checks if Description property is set
        /// </summary>
        /// <returns>true if Description property is set</returns>
        public Boolean IsSetDescription()
        {
            return  this.descriptionField != null;

        }


        /// <summary>
        /// Gets and sets the RequiredParameters property.
        /// </summary>
        [XmlElementAttribute(ElementName = "RequiredParameters")]
        public RequiredParameters RequiredParameters
        {
            get { return this.requiredParametersField ; }
            set { this.requiredParametersField = value; }
        }



        /// <summary>
        /// Sets the RequiredParameters property
        /// </summary>
        /// <param name="requiredParameters">RequiredParameters property</param>
        /// <returns>this instance</returns>
        public OperationInformation WithRequiredParameters(RequiredParameters requiredParameters)
        {
            this.requiredParametersField = requiredParameters;
            return this;
        }



        /// <summary>
        /// Checks if RequiredParameters property is set
        /// </summary>
        /// <returns>true if RequiredParameters property is set</returns>
        public Boolean IsSetRequiredParameters()
        {
            return this.requiredParametersField != null;
        }




        /// <summary>
        /// Gets and sets the AvailableParameters property.
        /// </summary>
        [XmlElementAttribute(ElementName = "AvailableParameters")]
        public AvailableParameters AvailableParameters
        {
            get { return this.availableParametersField ; }
            set { this.availableParametersField = value; }
        }



        /// <summary>
        /// Sets the AvailableParameters property
        /// </summary>
        /// <param name="availableParameters">AvailableParameters property</param>
        /// <returns>this instance</returns>
        public OperationInformation WithAvailableParameters(AvailableParameters availableParameters)
        {
            this.availableParametersField = availableParameters;
            return this;
        }



        /// <summary>
        /// Checks if AvailableParameters property is set
        /// </summary>
        /// <returns>true if AvailableParameters property is set</returns>
        public Boolean IsSetAvailableParameters()
        {
            return this.availableParametersField != null;
        }




        /// <summary>
        /// Gets and sets the DefaultResponseGroups property.
        /// </summary>
        [XmlElementAttribute(ElementName = "DefaultResponseGroups")]
        public DefaultResponseGroups DefaultResponseGroups
        {
            get { return this.defaultResponseGroupsField ; }
            set { this.defaultResponseGroupsField = value; }
        }



        /// <summary>
        /// Sets the DefaultResponseGroups property
        /// </summary>
        /// <param name="defaultResponseGroups">DefaultResponseGroups property</param>
        /// <returns>this instance</returns>
        public OperationInformation WithDefaultResponseGroups(DefaultResponseGroups defaultResponseGroups)
        {
            this.defaultResponseGroupsField = defaultResponseGroups;
            return this;
        }



        /// <summary>
        /// Checks if DefaultResponseGroups property is set
        /// </summary>
        /// <returns>true if DefaultResponseGroups property is set</returns>
        public Boolean IsSetDefaultResponseGroups()
        {
            return this.defaultResponseGroupsField != null;
        }




        /// <summary>
        /// Gets and sets the AvailableResponseGroups property.
        /// </summary>
        [XmlElementAttribute(ElementName = "AvailableResponseGroups")]
        public AvailableResponseGroups AvailableResponseGroups
        {
            get { return this.availableResponseGroupsField ; }
            set { this.availableResponseGroupsField = value; }
        }



        /// <summary>
        /// Sets the AvailableResponseGroups property
        /// </summary>
        /// <param name="availableResponseGroups">AvailableResponseGroups property</param>
        /// <returns>this instance</returns>
        public OperationInformation WithAvailableResponseGroups(AvailableResponseGroups availableResponseGroups)
        {
            this.availableResponseGroupsField = availableResponseGroups;
            return this;
        }



        /// <summary>
        /// Checks if AvailableResponseGroups property is set
        /// </summary>
        /// <returns>true if AvailableResponseGroups property is set</returns>
        public Boolean IsSetAvailableResponseGroups()
        {
            return this.availableResponseGroupsField != null;
        }






        /// <summary>
        /// XML fragment representation of this object
        /// </summary>
        /// <returns>XML fragment for this object.</returns>
        /// <remarks>
        /// Name for outer tag expected to be set by calling method. 
        /// This fragment returns inner properties representation only
        /// </remarks>


        protected internal String ToXMLFragment() {
            StringBuilder xml = new StringBuilder();
            if (IsSetName()) {
                xml.Append("<Name>");
                xml.Append(EscapeXML(this.Name));
                xml.Append("</Name>");
            }
            if (IsSetDescription()) {
                xml.Append("<Description>");
                xml.Append(EscapeXML(this.Description));
                xml.Append("</Description>");
            }
            if (IsSetRequiredParameters()) {
                RequiredParameters  requiredParameters = this.RequiredParameters;
                xml.Append("<RequiredParameters>");
                xml.Append(requiredParameters.ToXMLFragment());
                xml.Append("</RequiredParameters>");
            } 
            if (IsSetAvailableParameters()) {
                AvailableParameters  availableParameters = this.AvailableParameters;
                xml.Append("<AvailableParameters>");
                xml.Append(availableParameters.ToXMLFragment());
                xml.Append("</AvailableParameters>");
            } 
            if (IsSetDefaultResponseGroups()) {
                DefaultResponseGroups  defaultResponseGroups = this.DefaultResponseGroups;
                xml.Append("<DefaultResponseGroups>");
                xml.Append(defaultResponseGroups.ToXMLFragment());
                xml.Append("</DefaultResponseGroups>");
            } 
            if (IsSetAvailableResponseGroups()) {
                AvailableResponseGroups  availableResponseGroups = this.AvailableResponseGroups;
                xml.Append("<AvailableResponseGroups>");
                xml.Append(availableResponseGroups.ToXMLFragment());
                xml.Append("</AvailableResponseGroups>");
            } 
            return xml.ToString();
        }

        /**
         * 
         * Escape XML special characters
         */
        private String EscapeXML(String str) {
            StringBuilder sb = new StringBuilder();
            foreach (Char c in str)
            {
                switch (c) {
                case '&':
                    sb.Append("&amp;");
                    break;
                case '<':
                    sb.Append("&lt;");
                    break;
                case '>':
                    sb.Append("&gt;");
                    break;
                case '\'':
                    sb.Append("&#039;");
                    break;
                case '"':
                    sb.Append("&quot;");
                    break;
                default:
                    sb.Append(c);
                    break;
                }
            }
            return sb.ToString();
        }




    }

}